package com.solcoo.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.solcoo.pojo.Version;

@Repository
public class VersionDao {

	@Resource
	private SqlMapClient sqlMapClient;
	
	public Version queryVersion(String leixing) throws SQLException {
		return (Version) sqlMapClient.queryForObject("selectVersion", leixing);
	}

	public List<Version> queryVersions() throws SQLException {
		return (List<Version>) sqlMapClient.queryForList("selectVersions");
	}

	public void updateByLx(String version, String leixing) throws SQLException {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("leixing", leixing);
		param.put("version", version);
		sqlMapClient.update("updateByLx", param);
	}
}
